1. Field of the Invention
The present invention relates to a photoelectric switch, and more specifically relates to improvement in photoelectric switch that receives reflected light from a detection area to acquire color information and performs workpiece determination.
2. Description of Related Art
A photoelectric switch is a detector for detecting a workpiece by use of light. The photoelectric switch projects detected light, and receives light reflected by or light transmitted through a workpiece, or some other light, to perform workpiece determination. Based on the result of the workpiece determination, the photoelectric switch generates a detection signal. Types of the photoelectric switch include: a light receiving amount-type photoelectric switch that performs workpiece determination by use of a light receiving amount of reflected light or transmitted light from a detection area including a workpiece; a distance measurement-type photoelectric switch that measures a distance to the workpiece to perform workpiece determination, and a color discrimination-type photoelectric switch that performs workpiece determination by discriminating colors of the workpiece surface.
The light receiving amount-type photoelectric switch performs workpiece discrimination through use of variation in light receiving amount due to a difference in reflectance or color of the workpiece surface, a difference in distance to the workpiece, a difference in tilt (tilt angle) of the workpiece surface, or the like. This is a general-purpose photoelectric switch applicable to a large number of uses.
Meanwhile, the distance measurement-type photoelectric switch measures a characteristic in accordance with the shape of the workpiece as a distance to the workpiece, to perform the workpiece determination. This is less susceptible to variation in reflectance and color of the workpiece surface or variation in tilt (tilt angle) of the workpiece surface. Further, the color discrimination-type photoelectric switch performs the workpiece determination by use of the color of the workpiece surface. This is less susceptible to variation in reflectance of the workpiece surface, variation in distance to the workpiece, or variation in tilt (tilt angle) of the workpiece surface.
A conventional color discrimination-type photoelectric switch is provided with three light emitting elements for respectively generating red, green, and blue detected light, and one light receiving element for receiving reflected light to generate a light reception signal (e.g., Unexamined Japanese Patent Publication No. 2000-121440, Unexamined Japanese Patent Publication No. 2000-121441, Unexamined Japanese Patent Publication No. 2005-127869, and Unexamined Japanese Patent Publication No. 2005-291748). In this sort of photoelectric switch, based on light receiving amount levels Rk, Gk, Bk of the three colors, obtained by sequentially turning on the respective light emitting elements in a time-division manner, colors are represented by ratios of the light receiving amount levels of the three colors: rk=Rk/Mk, gk=Gk/Mk, bk=Bk/Mk (a sum of the light receiving amounts: Mk=Rk+Gk+Bk). It is then determined whether or not ratios r1, g1, b1 of the light receiving amount levels corresponding to the colors of the workpiece are coincident with ratios r0, g0, b0 of the light receiving amount levels corresponding to previously registered reference colors. Specifically, the ratio of the light receiving amount level of each color is compared with the ratio of the light receiving amount level of the reference color, to obtain a coincidence degree of the two pieces of color information. This coincidence degree is compared with a threshold for determination, to perform the workpiece determination.
The light receiving amount level of the reference color is defined based on the light receiving amount level of each color acquired at the timing instructed by the user. For example, based on a plurality of light receiving amount levels acquired within a predetermined period or on the ratios of the light receiving amount levels, the maximum value and the minimum value are obtained for each color component, and a median value of the maximum value and the minimum value is specified as the light receiving amount level of the reference color or the ratio of the light receiving amount level.
The conventional photoelectric switch described above uses the coincidence degree for the color discrimination to represent color information, which is normally represented by three parameters, by one parameter as the coincidence degree. Hence this photoelectric switch can be handled in a similar manner to the light receiving amount-type photoelectric switch that discriminates color information by use of a light receiving amount and a threshold, and the setting can be simply made. On the other hand, for accurately detecting such a workpiece where a tint changes within the same workpiece in the conventional photoelectric switch, for example, even when the reference color which has been defined from the maximum value and the minimum value obtained for each color component is used, the threshold for determination of the conventional photoelectric switch is required to be set sufficiently low in accordance with an amount of change in tint. That is, in the conventional photoelectric switch, even when an optimal reference color is obtained, even a workpiece with a color having a low coincidence degree with respect to the reference color is discriminated as a workpiece depending on an amount of change in tint, causing deterioration in detection accuracy, which has been problematic. For example in a case where the workpiece surface has color irregularity, a case where a distance to the workpiece varies or the position of the workpiece changes due to flapping or waving of a carrier device, or a case where ambient light is incident, the tint greatly changes even in the same workpiece. There has further been a problem of not being able to accurately detect a desired workpiece due to an influence of variation in tint of the workpiece among manufacturing lots, contamination on the workpiece surface, blurring of a printed mark, or color degradation, for example.